home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / listx / setup.exe / SORT.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-12  |  7.3 KB  |  226 lines

  1. VERSION 5.00
  2. Object = "{9FE255D1-F32E-11D0-9E15-444553540000}#1.0#0"; "MLISTX.OCX"
  3. Begin VB.Form frmSort 
  4.    BorderStyle     =   0  'None
  5.    ClientHeight    =   5835
  6.    ClientLeft      =   3630
  7.    ClientTop       =   5115
  8.    ClientWidth     =   7830
  9.    ControlBox      =   0   'False
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MDIChild        =   -1  'True
  13.    MinButton       =   0   'False
  14.    PaletteMode     =   1  'UseZOrder
  15.    ScaleHeight     =   5835
  16.    ScaleWidth      =   7830
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.CheckBox Check1 
  19.       Caption         =   "Sort Column 1 Numerically"
  20.       Height          =   330
  21.       Left            =   4500
  22.       TabIndex        =   8
  23.       Top             =   3375
  24.       Value           =   1  'Checked
  25.       Width           =   2505
  26.    End
  27.    Begin VB.Frame Frame2 
  28.       Caption         =   "Sort Column 2"
  29.       Height          =   885
  30.       Left            =   1815
  31.       TabIndex        =   4
  32.       Top             =   4740
  33.       Width           =   1395
  34.       Begin VB.OptionButton optSort 
  35.          Caption         =   "Ascending"
  36.          Height          =   270
  37.          Index           =   2
  38.          Left            =   105
  39.          TabIndex        =   6
  40.          Top             =   255
  41.          Value           =   -1  'True
  42.          Width           =   1260
  43.       End
  44.       Begin VB.OptionButton optSort 
  45.          Caption         =   "Descending"
  46.          Height          =   270
  47.          Index           =   3
  48.          Left            =   105
  49.          TabIndex        =   5
  50.          Top             =   480
  51.          Width           =   1155
  52.       End
  53.    End
  54.    Begin VB.Frame Frame1 
  55.       Caption         =   "Sort Column 1"
  56.       Height          =   885
  57.       Left            =   360
  58.       TabIndex        =   1
  59.       Top             =   4740
  60.       Width           =   1395
  61.       Begin VB.OptionButton optSort 
  62.          Caption         =   "Descending"
  63.          Height          =   270
  64.          Index           =   1
  65.          Left            =   105
  66.          TabIndex        =   3
  67.          Top             =   480
  68.          Width           =   1155
  69.       End
  70.       Begin VB.OptionButton optSort 
  71.          Caption         =   "Ascending"
  72.          Height          =   270
  73.          Index           =   0
  74.          Left            =   90
  75.          TabIndex        =   2
  76.          Top             =   255
  77.          Value           =   -1  'True
  78.          Width           =   1200
  79.       End
  80.    End
  81.    Begin MabryCtl.MList MList1 
  82.       Height          =   4215
  83.       Left            =   360
  84.       TabIndex        =   0
  85.       Top             =   360
  86.       Width           =   2925
  87.       _ExtentX        =   5159
  88.       _ExtentY        =   7435
  89.       BackColor       =   16777215
  90.       Caption         =   "Caption"
  91.       CaptionAlignment=   2
  92.       Object.TabStop         =   -1  'True
  93.       ThreedShadowColor=   -2147483627
  94.       MousePointer    =   -842150451
  95.       MultiSelect     =   1
  96.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  97.          Name            =   "MS Sans Serif"
  98.          Size            =   8.25
  99.          Charset         =   0
  100.          Weight          =   400
  101.          Underline       =   0   'False
  102.          Italic          =   0   'False
  103.          Strikethrough   =   0   'False
  104.       EndProperty
  105.       BeginProperty Columns {23BAA6DE-05A6-11D1-9E15-0020AFD6A9D5} 
  106.          ColumnCount     =   2
  107.          BeginProperty Column0 {23BAA6E0-05A6-11D1-9E15-0020AFD6A9D5} 
  108.             Object.Width           =   40
  109.             MinWidth        =   0
  110.             MaxWidth        =   -1
  111.             UserResizeEnabled=   -1
  112.             Heading         =   "Col 1"
  113.             Object.Visible         =   -1
  114.             ColumnAlignment =   0
  115.             HeadingAlignment=   0
  116.          EndProperty
  117.          BeginProperty Column1 {23BAA6E0-05A6-11D1-9E15-0020AFD6A9D5} 
  118.             Object.Width           =   40
  119.             MinWidth        =   0
  120.             MaxWidth        =   -1
  121.             UserResizeEnabled=   -1
  122.             Heading         =   "Col 2"
  123.             Object.Visible         =   -1
  124.             ColumnAlignment =   0
  125.             HeadingAlignment=   0
  126.          EndProperty
  127.       EndProperty
  128.    End
  129.    Begin VB.Label Label2 
  130.       Alignment       =   2  'Center
  131.       Caption         =   "List/X Does It All!"
  132.       BeginProperty Font 
  133.          Name            =   "MS Sans Serif"
  134.          Size            =   12
  135.          Charset         =   0
  136.          Weight          =   400
  137.          Underline       =   0   'False
  138.          Italic          =   0   'False
  139.          Strikethrough   =   0   'False
  140.       EndProperty
  141.       ForeColor       =   &H00FF0000&
  142.       Height          =   405
  143.       Left            =   3585
  144.       TabIndex        =   9
  145.       Top             =   3915
  146.       Width           =   3960
  147.    End
  148.    Begin VB.Label Label1 
  149.       Caption         =   $"Sort.frx":0000
  150.       BeginProperty Font 
  151.          Name            =   "MS Sans Serif"
  152.          Size            =   9.75
  153.          Charset         =   0
  154.          Weight          =   400
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       Height          =   2790
  160.       Left            =   3525
  161.       TabIndex        =   7
  162.       Top             =   330
  163.       Width           =   4020
  164.    End
  165. Attribute VB_Name = "frmSort"
  166. Attribute VB_GlobalNameSpace = False
  167. Attribute VB_Creatable = False
  168. Attribute VB_PredeclaredId = True
  169. Attribute VB_Exposed = False
  170. Option Explicit
  171. Private Sub Check1_Click()
  172.    Dim foo As CSort
  173.    ' VB needs a little help understanding what object
  174.    ' is being returned by SortObject
  175.    Set foo = MList1.Columns(0).SortObject
  176.    If (Check1.Value = 1) Then
  177.       foo.NumericSort = True
  178.    Else
  179.       foo.NumericSort = False
  180.    End If
  181.    ' Force a resort
  182.    MList1.Sorted = False
  183.    MList1.Sorted = True
  184. End Sub
  185. Private Sub Form_Load()
  186.    Dim i As Integer
  187.    Dim j As Integer
  188.    Dim sorter As CSort
  189.    ' Add something sortable to the listbox
  190.    For i = 1 To 27 Step 3
  191.       For j = 1 To 5
  192.          MList1.AddItem i & "," & j
  193.       Next
  194.    Next
  195.    ' Assign the sort object to column zero.  You can
  196.    ' assign the same or different sort objects to
  197.    ' as many columns as the listbox has.
  198.    Set sorter = New CSort
  199.    MList1.Columns(0).SortObject = sorter
  200.    ' Set sort type
  201.    sorter.NumericSort = True
  202.    ' Set sortorder, ascending for both columns
  203.    MList1.sortorder = "a a"
  204.    ' Enable sorting, the sorter's comparison method
  205.    ' is going to get called during the sort
  206.    MList1.Sorted = True
  207. End Sub
  208. Private Sub optSort_Click(Index As Integer)
  209.    Dim sortorder As String
  210.    ' One of the sortorder options changed, build
  211.    ' new sort order string
  212.    If (optSort(0)) Then
  213.       sortorder = "0a "
  214.    Else
  215.       sortorder = "0d "
  216.    End If
  217.    If (optSort(2)) Then
  218.       sortorder = sortorder & "1a"
  219.    Else
  220.       sortorder = sortorder & "1d"
  221.    End If
  222.    ' Assign sort order string, since MList1.Sort = True
  223.    ' sorting happens immediately
  224.    MList1.sortorder = sortorder
  225. End Sub
  226.